package com.xyw.code.springcloudnacosconfig;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@SpringBootApplication
public class SpringCloudNacosConfigApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringCloudNacosConfigApplication.class, args);
    }

    @Slf4j
    @RestController
    //配置内容支持动态刷新
    @RefreshScope
    static class TestController {

        @Value("${didispace.title:}")
        private String title;
        @Value("${actuator.value:}")
        private String aValue;
        @Value("${log.value:}")
        private String lValue;

        @GetMapping("/test")
        public String hello() {
            return title+"_____"+aValue+"______"+lValue;
        }

    }

}
